#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;

int n,b[N<<1],tot,l[N],r[N],deg[N<<1],h[N<<1],cnt = 1,now[N<<1],ans[N<<1];
struct edge{int v,w,nxt;}e[N<<2];
bool v[N<<2],vis[N<<1];
void link(int x,int y,int w){e[++cnt] = (edge){y,w,h[x]};h[x] = cnt;}

void dfs(int x){
	vis[x] = 1;
	for(int i = now[x],y;i;i = e[now[x]].nxt){
		now[x] = i; if(v[i]) continue; y = e[i].v; v[i] = v[i^1] = 1;
		ans[e[i].w] = x < y; dfs(y);
	}
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1;i <= n;i++) b[++tot] = l[i] = in,b[++tot] = r[i] = in+1;
	sort(b+1,b+tot+1); tot = unique(b+1,b+tot+1) - b - 1;
	for(int i = 1;i <= n;i++){
		l[i] = lower_bound(b+1,b+tot+1,l[i]) - b;
		r[i] = lower_bound(b+1,b+tot+1,r[i]) - b;
		deg[l[i]]++; deg[r[i]]++; link(l[i],r[i],i); link(r[i],l[i],i);
	}
	int lst = 0;
	for(int i = 1;i <= tot;i++){
		if(!(deg[i] & 1)) continue;
		if(lst) link(lst,i,0),link(i,lst,0),lst = 0;
		else lst = i;
	}for(int i = 1;i <= tot;i++) now[i] = h[i];
	for(int i = 1;i <= tot;i++) if(!vis[i]) dfs(i);
	for(int i = 1;i <= n;i++){
		if(ans[i]) printf("1 ");
		else printf("0 ");
	}
	return 0;
}

